package com.rjxy.plansystemmanagement.mapper;

import com.rjxy.plansystemmanagement.entity.FlightInformation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FlightMapper {
    @Select("select * from FlightInformation")
    List<FlightInformation> list();

    @Delete("delete from FlightInformation where id = #{id}")
    void deleteFlight(Integer id);

    @Insert("insert into FlightInformation(JJPrice,JJRTicket,JJZTicket,TDPrice,TDRTicket,TDZTicket,FlightType,CFCity,CFTime,HBName,DDCity,DDTime,AircraftID) " +
            "VALUES (#{JJPrice},#{JJRTicket},#{JJZTicket},#{TDPrice},#{TDRTicket},#{TDZTicket},#{FlightType},#{CFCity},#{CFTime},#{HBName},#{DDCity},#{DDTime},#{AircraftID})")
    void addFlight(FlightInformation flightInformation);

    @Select("select * from FlightInformation where  id  = #{id}")
    FlightInformation getFlihtById(Integer id);

    void updateFlight(FlightInformation flightInformation);

    @Select("select * from FlightInformation where CFCity = #{cfCity} and DDCity = #{ddCity}")
    List<FlightInformation> getFlightByCFCityAndDDCity(String cfCity, String ddCity);
}
